package cn.stylefeng.guns.modular.school.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.modular.school.entity.ParkingInfo;
import cn.stylefeng.guns.modular.school.model.params.ParkingInfoParam;
import cn.stylefeng.guns.modular.school.service.ParkingInfoService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 停车库信息控制器
 *
 * @author 
 * @Date 2020-04-14 17:15:05
 */
@Controller
@RequestMapping("/parkingInfo")
public class ParkingInfoController extends BaseController {

    private String PREFIX = "/school/parkingInfo";

    @Autowired
    private ParkingInfoService parkingInfoService;

    /**
     * 跳转到主页面
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/parkingInfo.html";
    }

    /**
     * 新增页面
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/parkingInfo_add.html";
    }

    /**
     * 编辑页面
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/parkingInfo_edit.html";
    }

    /**
     * 新增接口
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(ParkingInfoParam parkingInfoParam) {
        this.parkingInfoService.add(parkingInfoParam);
        return ResponseData.success();
    }

    /**
     * 编辑接口
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(ParkingInfoParam parkingInfoParam) {
        this.parkingInfoService.update(parkingInfoParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(ParkingInfoParam parkingInfoParam) {
        this.parkingInfoService.delete(parkingInfoParam);
        return ResponseData.success();
    }

    /**
     * 查看详情接口
     *
     * @author 
     * @Date 2020-04-14
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(ParkingInfoParam parkingInfoParam) {
        ParkingInfo detail = this.parkingInfoService.getById(parkingInfoParam.getSeqId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author 
     * @Date 2020-04-14
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(ParkingInfoParam parkingInfoParam) {
        return this.parkingInfoService.findPageBySpec(parkingInfoParam);
    }

}


